package com.mvc.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
@RequestMapping("/api")
public class InfoController {

    @RequestMapping("/t")
    public ModelAndView test(ModelAndView modelAndView){

        modelAndView.addObject("username","封装数据");
        modelAndView.setViewName("success");
       return modelAndView;
    }

    @RequestMapping("/t1")
    public String test1(Model model){
        model.addAttribute("username","使用model封装数据");

        return "success";
    }
}
